package com.dpiinc.TechPage.repository

enum class Status {
    RUNNING,
    SUCCESS,
    FAILED
}

data class NetworkState constructor(
        val status: Status,
        val msg: String? = null) {

    var tag: Any? = null

    constructor(tag: Any, status: Status, msg: String? = null) : this(status, msg) {
        this.tag = tag
    }

    companion object {
        val LOADED = NetworkState(Status.SUCCESS)
        val LOADING = NetworkState(Status.RUNNING)
        fun error(msg: String?) = NetworkState(Status.FAILED, msg)
    }

    override fun toString(): String {
        return "NetworkState(tag=$tag, status=$status, msg=$msg)"
    }
}